package com.huike.clues.service.impl;

import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbCluesRecordMapper;
import com.huike.clues.service.ITbCluesRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: Rodgers
 * @Date 2022/3/31 13:34
 */
@Service
public class TbCluesRecordServiceImpl implements ITbCluesRecordService {

    @Autowired(required = false)
    private TbCluesRecordMapper tbCluesRecordMapper;

    @Autowired(required = false)
    private TbClueMapper tbClueMapper;

    /**
     * 根据线索id查询线索根据记录
     *
     * @param clueId
     * @return
     */
    @Override
    public List<TbClueTrackRecord> selectCluesRecordList(Long clueId) {
        return tbCluesRecordMapper.selectCluesRecordByClueId(clueId);
    }

    /**
     * 新增跟进线索
     *
     * @param trackRecord
     * @param tbClue
     * @return
     */
    @Override
    public Integer add(TbClueTrackRecord trackRecord, TbClue tbClue) {
        tbClueMapper.updateTbClue(tbClue);
        return tbCluesRecordMapper.add(trackRecord);
    }
}
